package com.example.study_manger.repository;
import com.example.study_manger.entity.Role;
import com.example.study_manger.entity.TrainingPlan;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TrainingPlanRe extends JpaRepository<TrainingPlan, Long>, JpaSpecificationExecutor<TrainingPlan> {
    @Query("select t from TrainingPlan t where t.organization.id= ?1")
    List<TrainingPlan> findTrainingPlanByOrganizationId(String organizationId);

    List<TrainingPlan> findAllByCreator(Role role);
}
